﻿//codemirror.css
.code-mirror {
    font-family: monospace;
}

.code-mirror-scroll {
    height: 300px;
    // This is needed to prevent an IE[67] bug where the scrolled content is visible outside of the scrolling box.
    position: relative;
    background-color: @color-white;
    overflow: auto;
}

.form-control .code-mirror-scroll {
    background-color: transparent;
}

.code-mirror-gutter {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
    background-color: @color-gray-150;
    border-right: 1px solid @color-gray-150;
    min-width: 2em;
    height: 100%;
}

.code-mirror-gutter-text {
    color: #aaa;
    text-align: right;
    padding: .4em .2em .4em .4em;
    white-space: pre !important;
}

.code-mirror-lines {
    padding: .4em;
}

.code-mirror pre {
    border-radius: 0;
    border-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    margin: 0;
    white-space: pre;
    word-wrap: normal;
    height: auto !important;
    overflow: visible !important;
}

.code-mirror-wrap pre {
    word-wrap: break-word;
    white-space: pre-wrap;
}

.code-mirror-wrap .code-mirror-scroll {
    overflow-x: hidden;
}

.code-mirror textarea {
    outline: none !important;
}

.code-mirror pre.code-mirror-cursor {
    z-index: 10;
    position: absolute;
    visibility: visible !important;
    border-left: 1px solid #ccc;
}

.code-mirror-focused pre.code-mirror-cursor {
    visibility: visible;
    border-left: 1px solid black;
}

.code-mirror-focused pre.code-mirror-cursor-hidden {
    visibility: hidden !important;
}

.code-mirror-selected {
    background: @color-gray-140;
}

.code-mirror-focused .code-mirror-selected {
    background: #d7d4f0;
}

.code-mirror-searching {
    background: #ffa;
    background: rgba(255, 255, 0, .4);
}

.code-mirror-matchingbracket {
    color: #0f0 !important;
}

.code-mirror-nonmatchingbracket {
    color: #f22 !important;
}


.code-mirror-searched {
    background: yellow;
}


// Default styles
.CM {
    position: relative;
    border: 2px solid @color-gray-130;
    min-width: 200px;
    padding: 0;
    line-height: 16px;
    font: 10pt monospace;
    color: #000000;
    border-radius: 3px;
    box-sizing: border-box;
    z-index: @zindex-codemirror;

    &.form-control.CM-singleline {
        padding: @padding-base-vertical @padding-base-horizontal * 0.5;
    }
}

    .CM code {
        font: 90% Courier, monospace;
        color: #144;
    }

    .CM pre.code {
        margin: 1.1em 12px;
        padding: 0.4em;
        border: #b5c3d6 1px solid;
        font-family: @font-family-monospace;
        color: #000000;
    }

    .CM .CM-wrapping .warn {
        color: #cc0000;
    }

    .CM .CM-line-numbers {
        width: 36px;
        padding: 0.4em 8px 0 0;
        margin: 0;
        border-right: @color-gray-150 1px solid;
        text-align: right;
        font: 10pt monospace;
        background: #fafafa;
        color: #000000;
    }

.RTL .CM .CM-line-numbers {
    padding: 0.4em 0 0 8px;
    border-right: none;
    border-left: @color-gray-150 1px solid;
    text-align: left;
}

.CM .CM-toolbar {
    overflow: hidden;
    height: 22px;
    min-width: 320px;
    padding: 2px 0 4px 0;
    text-align: center;
    background: @color-gray-150;
}

.CM .CM-toolbar-buttonsBox {
    float: left;
    margin: 0 auto auto 10px;
}

.RTL .CM .CM-toolbar-buttonsBox {
    float: right;
    margin: 0 10px auto auto;
}

.CM .CM-toolbar img {
    height: 16px;
    margin: 0 4px 2px 4px;
    width: 16px;
    padding: 2px;
    border: transparent 1px solid;
    vertical-align: middle;
    line-height: 16px;
    text-decoration: none;
}

    .CM .CM-toolbar img:hover {
        border: @color-gray-100 1px solid;
        background-color: @color-gray-100;
        cursor: pointer;
    }

.CM .CM-toolbar .Sep {
    height: 16px;
    width: 1px;
    vertical-align: middle;
    line-height: 16px;
    text-decoration: none;
}

    .CM .CM-toolbar .Sep:hover {
        border: transparent 1px solid;
        background: none;
        cursor: default;
    }

.CM .CM-toolbar img.active {
    border: @color-gray-100 1px solid;
    background-color: @color-gray-100;
}

.CM .CM-toolbar-linesBox {
    width: 130px;
    float: right;
    text-align: left;
    margin: 2px 10px auto auto;
}

.RTL .CM .CM-toolbar-linesBox {
    float: left;
    text-align: right;
    margin: 2px auto auto 10px;
}

.CM .CM-toolbar-currentLine {
    width: 50px;
    height: 14px;
    margin: 0 2px 0 2px;
    padding: 0;
    vertical-align: middle;
    text-align: center;
    font: 11px Verdana;
    overflow: hidden;
}

.CM .CM-bookmarks {
    position: absolute;
    right: 0;
    top: 0;
    width: 250px;
    height: 100%;
    border-left: solid 1px #b5c3d6;
    background: #ffffff;
    text-align: left;
    overflow: auto;
    z-index: 19994;
}

.RTL .CM .CM-bookmarks {
    position: absolute;
    left: 0;
    right: auto;
    border-left: none;
    border-right: solid 1px #b5c3d6;
}

.CM .CM-bookmarks a {
    display: block;
    margin: 1px;
    padding: 1px 2px 1px 5px;
    font: 11px Verdana;
    text-decoration: none;
    white-space: nowrap;
    color: #000000;
}

.RTL .CM .CM-bookmarks a {
    margin: 1px 5px 1px 2px;
}

.CM .CM-bookmarks a:hover {
    cursor: pointer;
    background-color: @color-blue-130;
}

.CM-singleline pre {
    font-family: @font-family-base;
}

.CM-singleline .code-mirror-lines {
    padding: .1em;
}

.CM-toolbar-totalLines {
    vertical-align: middle;
}

.CM {
    // Immitate form-control
    line-height: @line-height-100;
    color: @input-color;
    vertical-align: baseline;
    background-color: @input-bg;
    width: 100%;
    height: auto;
    min-height: @base-unit * 2;
    display: inline-block;
    box-sizing: border-box;
    transition: ~"border-color ease-in-out .15s, box-shadow ease-in-out .15s";
    .code-mirror-focus();

    &.AutoSize {
        padding: @padding-base-vertical @padding-base-horizontal * 0.5;
    }
}

    // Special styles
    .CM.CM-FullScreen {
        position: fixed;
        height: auto;
        width: auto;
        left: 0;
        top: 0;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: @zindex-codemirror-fullsreen;
        border: solid 1px #ccc;
    }

        .CM.CM-FullScreen .code-mirror-scroll {
            position: absolute;
            height: auto;
            width: auto;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
            z-index: @zindex-codemirror-fullsreen;
            margin: 0px 1px 28px 0px;
        }


        .CM.CM-FullScreen .CM-toolbar {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            z-index: @z-index-codemirror-toolbar;
        }

textarea[disabled="disabled"] + .code-mirror .code-mirror-scroll {
    background-color: #f4f4f4;
}

textarea[disabled="disabled"] + .code-mirror .code-mirror-cursor {
    display: none;
}

.ValidationCode .code-mirror-cursor {
    display: inline !important;
    visibility: visible !important;
    border: 1px solid #f00 !important;
    background-color: #f44;
    opacity: 0.5;
    filter: alpha(opacity=50);
}

.AutoSize .code-mirror-scroll {
    height: 30px;
}

.TreeEditor .AutoSize .code-mirror-scroll {
    overflow: auto;
    width: 500px;
    height: 30px;
}

.MacroDesigner .TreeEditor .AutoSize .code-mirror-scroll {
    width: 250px;
}

// specific styles
.macro-editor-form-control {
    .fix-white-space !important;
    display: inline;

    div:nth-child(1):not(.code-mirror-gutter):not(.code-mirror-gutter-text) {
        display: inline-block;
        position: relative;
        font-size: @font-size-base;
    }

    div.CM.CM-silver.CM-singleline.form-control {
        width: @base-unit * 30;
    }

    .code-mirror-scroll {
        background-color: transparent;
    }
    // Icon only buttons after form control, e.g. textbox with insert macro button
    .form-control + .btn.icon-only {
        padding-left: 0;
    }
}

.macro-tree-editor-form-control {
    .fix-white-space();
    display: inline;
    // Must have negative margin the width of the button to ensure correct positioning of following elements
    margin-right: ((@icon-size-80 + (@btn-icononly-padding * 2)) * -1);
    // Cancels line-break + ensures absolute JavaSript positioning of sub-elements is relative to this element
    div:nth-child(1) {
        display: inline-block;
        position: relative;
        font-size: @font-size-base;
    }
    // button inside text-box
    button.btn.icon-only {
        position: relative;
        left: (@icon-size-80 + (@btn-icononly-padding * 2) + @margin-50)* -1;
        // CodeMirror (.CM in this file) has @zindex-codemirror. Button has to be on top of it.
        // Fullscreen CM (.CM.CM-FullScreen in this file) has @zindex-codemirror-fullsreen. Button has to be underneath it.
        z-index: @zindex-codemirror + 1;
    }

    div.CM.CM-silver.CM-singleline.form-control {
        padding-right: @base-unit * 1.5;
        .input-width-100;
    }

    div.CM.CM-blue {
        .input-width-100;
        display: block;
        padding: @padding-base-vertical @padding-base-horizontal * 0.5;
        font-size: @font-size-base;

        &[disabled],
        &[readonly] {
            color: @input-color-disabled;
            background-color: @input-bg-disabled;
            border-color: @input-bg-disabled;
            .placeholder(@input-color-disabled);
        }

        &[disabled] {
            cursor: not-allowed;
        }

        height: auto;
        min-height: @base-unit * 2;
        display: inline-block;
        margin-right: @base-unit * 0.5;
        padding-right: @base-unit * 1.5;

        .code-mirror-scroll {
            background-color: transparent;
            overflow:hidden;
        }
    }
}


// Condition builder in validation rules
.form-properties .condition-builder .btn {
    margin-top: @base-unit * 0.5;
}

// Macro auto completion
.AutoCompleteHints {
    background-color: @color-white;
    border: 2px solid @color-gray-130;
    padding: @base-unit * 0.25;
    overflow: auto;
    max-height: 200px;
    overflow-x: hidden;
    min-width: 70px;
    box-shadow: 1px 1px 2px #888888;
    font-size: @font-size-base;

    ul {
        padding: 0;
        margin: 0;
        list-style-type: none;
    }

    a {
        text-decoration: none;
        color: black;
        cursor: default;
    }

    i {
        margin-right: 0px;
    }

    div {
        display: inline-block;
        width: 100%;
        height: 20px;
        margin-right: 1px;
    }

    li {
        height: 20px;
    }

    .hidden {
        display: none;
    }

    .HiddenProperty a {
        color: grey;
    }

    .selected div {
        background-color: #39f;

        a {
            color: white;
        }
    }
}

.AutoCompleteContext {
    background: @color-orange-130;
    padding: @base-unit;
    overflow: auto;
    box-sizing: border-box;
    white-space: pre-wrap;
    box-shadow: 1px 1px 2px #888888;
}
